
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh_CN" xml:lang="zh_CN" >
	<head>
  		<title>ZKAccess6.0 门禁管理系统</title>
  		<!-- 不从缓存中加载，每次必须加载国际化 -->
		<meta http-equiv="Pragma" content="no-cache" ></meta>
		<meta http-equiv="Cache-Control" content="no-cache"></meta>
		<meta http-equiv="Expires" content="0"></meta>
		
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"></meta>
		<meta http-equiv="description" content="this is my page"></meta>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8"></meta>
		<!-- 30分钟自动跳转到登录页面 
		<meta http-equiv="refresh" content="1800;url=http://www.baidu.com"></meta>
		 -->
		<!--解决IE8链接下划线贴得太近-->
		<meta name="robots" content="NONE,NOARCHIVE" />
		
<!-- 加载公共部分js和css begin-->

<link rel="stylesheet" type="text/css" href="/public/css/base.css" />
<link rel="stylesheet" type="text/css" href="/public/css/whole.css" media="screen" />
<link rel="stylesheet" type="text/css" href="/public/css/head.css" />
<link rel="stylesheet" type="text/css" href="/public/css/dhtmlxGrid.css" />

<script src="/public/controls/jquery/jquery.js"></script>
<script src="/public/controls/jquery/jquery.form.js"></script>
<script src="/public/controls/jquery/jquery.validate.js"></script>
<script src="/public/controls/jquery/jquery.jplayer.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="/public/controls/jquery/jquery.alerts.css"/>
<script type="text/javascript" src="/public/controls/jquery/jquery.alerts.js"></script>
<script type="text/javascript" src="/public/controls/jquery/jquery.hotkeys.js"></script>

<link type="text/css" rel="stylesheet" href="/public/controls/jBox/Skins/Default/jbox.css"/>
<script type="text/javascript" src="/public/controls/jBox/jquery.jBox-2.3.min.js"></script>
<script type="text/javascript" src="/public/controls/jBox/i18n/jquery.jBox-zh-CN.js"></script>
<script src="public_common.js.action"></script>
<!-- 加载公共部分js和css end-->
		
		
		<!-- 加载dhx组件的css和js begin-->
		<link charset="utf-8" title="no title" media="screen" type="text/css" href="/public/controls/dhtmlx/dhtmlxTree/codebase/dhtmlxtree.css" rel="stylesheet"/>
		<link charset="utf-8" title="no title" media="screen" type="text/css" href="/public/controls/dhtmlx/dhtmlxTabbar/codebase/dhtmlxtabbar.css" rel="stylesheet"/>
		<link charset="utf-8" title="no title" media="screen" type="text/css" href="/public/controls/dhtmlx/dhtmlxWindows/codebase/dhtmlxwindows.css" rel="stylesheet"/>
		<link charset="utf-8" title="no title" media="screen" type="text/css" href="/public/controls/dhtmlx/dhtmlxLayout/codebase/dhtmlxlayout.css" rel="stylesheet"/>
		<link charset="utf-8" title="no title" media="screen" type="text/css" href="/public/controls/dhtmlx/dhtmlxWindows/codebase/skins/dhtmlxwindows_dhx_skyblue.css" rel="stylesheet"/>
		<link charset="utf-8" title="no title" media="screen" type="text/css" href="/public/controls/dhtmlx/dhtmlxLayout/codebase/skins/dhtmlxlayout_dhx_skyblue.css" rel="stylesheet"/>
		
		<!-- 工具栏（操作栏）控件 因为其dhtmlxcommon.js存在bug，所有使用了官网示例源码，为了保证后面的兼容，所以放到了最前面 -->
		<link charset="utf-8" media="screen" type="text/css" href="/public/controls/dhtmlx/dhtmlxToolbar/codebase/skins/dhtmlxtoolbar_dhx_skyblue.css" rel="stylesheet"/>
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxToolbar/codebase/dhtmlxcommon.js"></script>
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxToolbar/codebase/dhtmlxtoolbar.js"></script>
		<!-- 
		<script charset="utf-8" type="text/javascript" src="http://www.dhtmlx.com/docs/products/dhtmlxToolbar/codebase/dhtmlxcommon.js"></script>
		<script charset="utf-8" type="text/javascript" src="http://www.dhtmlx.com/docs/products/dhtmlxToolbar/codebase/dhtmlxtoolbar.js"></script>
		 -->
		
		<!-- 下拉框控件 -->
		<link rel="STYLESHEET" type="text/css" href="/public/controls/dhtmlx/dhtmlxCombo/codebase/dhtmlxcombo.css"/>
		<script  src="/public/controls/dhtmlx/dhtmlxCombo/codebase/dhtmlxcombo.js"></script>
		<script  src="/public/controls/dhtmlx/dhtmlxCombo/codebase/ext/dhtmlxcombo_whp.js"></script>
		<script  src="/public/controls/dhtmlx/dhtmlxCombo/codebase/ext/dhtmlxcombo_extra.js"></script>
		
		<!-- 因为所有控件中的dhtmlxcommon_debug.js 都是一样的，这里已grid为中心-->
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxGrid/codebase/dhtmlxcommon_debug.js"></script>
		
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxTree/codebase/dhtmlxtree.js"></script>
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxTree/codebase/ext/dhtmlxtree_xw.js"></script>
		
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxTabbar/codebase/dhtmlxtabbar.js"></script>
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxTree/codebase/ext/dhtmlxtree_attrs.js"></script>
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxLayout/codebase/dhtmlxlayout.js"></script>
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxLayout/codebase/dhtmlxcontainer.js"></script>
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxWindows/codebase/dhtmlxwindows.js"></script>
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxWindows/codebase/dhtmlxcontainer.js"></script>
		 
		<link rel="stylesheet" type="text/css" href="/public/controls/dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.css"/>
		<link rel="stylesheet" type="text/css" href="/public/controls/dhtmlx/dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_skyblue.css"/>
		<link rel="stylesheet" type="text/css" href="/public/controls/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_pgn_bricks.css"/>
		
		
		<!-- 日期控件 -->
		<link rel="STYLESHEET" type="text/css" href="/public/controls/dhtmlx/dhtmlxCalendar/codebase/dhtmlxcalendar.css"/>
		<link rel="STYLESHEET" type="text/css" href="/public/controls/dhtmlx/dhtmlxCalendar/codebase/skins/dhtmlxcalendar_dhx_skyblue.css"/>
		<script type="text/javascript" src="/public/controls/dhtmlx/dhtmlxCalendar/codebase/dhtmlxcalendar.js"></script>
		
		<!-- 表单控件 -->
		<link rel="stylesheet" type="text/css" href="/public/controls/dhtmlx/dhtmlxForm/codebase/skins/dhtmlxform_dhx_skyblue.css"/>
		<script src="/public/controls/dhtmlx/dhtmlxForm/codebase/dhtmlxform.js"></script>
		
	
		<script type="text/javascript">
			window.dhx_globalImgPath = "/public/controls/dhtmlx/dhtmlxCombo/codebase/imgs/";
		</script>
		
		<!-- 基本核心js -->
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
		
		<!-- 加载html中table时 -->
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_start.js"></script>
		
		<!-- 处理json格式的js(如分页) -->
		<script src="/public/controls/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_data.js"></script>
		<script src="/public/controls/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_json.js"></script>
		<!-- 分页过滤和分隔符 -->
		<script src="/public/controls/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_pgn.js"></script>
		<script src="/public/controls/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_filter.js"></script>
		<script src="/public/controls/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_markers.js"></script>
		<!-- 分栏可横向滚动 -->
		<script src="/public/controls/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_splt.js"></script>
		<script src="/public/controls/dhtmlx/dhtmlxGrid/codebase/excells/dhtmlxgrid_excell_cntr.js"></script>
		<!-- 自定义显示字段-->
		<script src="/public/controls/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_hmenu.js"></script>
		<!-- 可拖动列 -->
		<script src="/public/controls/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_mcol.js"></script>
		
		<!-- 保存信息到Cookie(列宽，自定义的显示字段等) -->
		<script src="/public/controls/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_ssc.js"></script>
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_post.js"></script>
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_srnd.js"></script>
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxGrid/codebase/excells/dhtmlxgrid_excell_sub_row.js"></script>	
		<script src="/public/controls/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_start.js"></script>
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxGrid/codebase/excells/dhtmlxgrid_excell_link.js"></script>
		<!-- 加载dhx组件的css和js end-->
		
		<!-- dhx组件中的json树形菜单、左右选择js和cs -->
		<link charset="utf-8" title="no title" media="screen" type="text/css" href="/public/controls/dhtmlx/dhtmlxForm/codebase/skins/dhtmlxform_dhx_skyblue.css" rel="stylesheet"/>
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxForm/codebase/dhtmlxform.js"></script>
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxTree/codebase/ext/dhtmlxtree_json.js"></script>
		<!-- 引入的js文件找不到，估计名字写错，如果改的不对，请撤回  update by: ob.huang  2013-05-15 -->
		<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxTree/codebase/ext/dhtmlxtree_lf.js"></script>

		<!-- 图表控件 -->
		<script src="/public/controls/dhtmlx/dhtmlxChart/codebase/dhtmlxchart.js" type="text/javascript"></script>
		<link rel="STYLESHEET" type="text/css" href="/public/controls/dhtmlx/dhtmlxChart/codebase/dhtmlxchart.css"/>
		
		<!-- Menu控件 -->
		<script src="/public/controls/dhtmlx/dhtmlxMenu/codebase/dhtmlxmenu.js" type="text/javascript"></script>
		<script src="/public/controls/dhtmlx/dhtmlxMenu/codebase/ext/dhtmlxmenu_ext.js" type="text/javascript"></script>
		<link rel="STYLESHEET" type="text/css" href="/public/controls/dhtmlx/dhtmlxMenu/codebase/skins/dhtmlxmenu_dhx_skyblue.css"/>
		
		<!-- dataView控件 -->
		<script type="text/javascript" src="/public/controls/dhtmlx/dhtmlxDataView/codebase/dhtmlxdataview.js"></script>
		<link rel="STYLESHEET" type="text/css" href="/public/controls/dhtmlx/dhtmlxDataView/codebase/dhtmlxdataview.css"/>
		
		
		
		<!-- 封装调用dhtmlxGrid的js 不适用datalist的不需要加载该脚本（上同），需处理--------- -->	
		
		<script src="public_dhtmlxComboxTree.js.action"></script>
		<script src="public_dhtmlxPaging.js.action"></script>
		<script src="public_dhtmlxCommon.js.action"></script>
		<script src="public_commonValidate.js.action"></script>
		<script src="public_search.js.action"></script>
		<script src="public_init.js.action"></script>
		<!-- 消息提示框控件 -->
		<link rel="STYLESHEET" type="text/css" href="/public/controls/dhtmlx/dhtmlxMessage/codebase/skins/dhtmlxmessage_dhx_skyblue.css"/>
		<script type="text/javascript" src="/public/controls/dhtmlx/dhtmlxMessage/codebase/dhtmlxmessage.js"></script>
				
			<!-- 加载模块中要导入的css和js -->
<link rel="stylesheet" type="text/css" href="/acc/css/acc.css?un=1427680124519" media="screen" />
<script type="text/javascript" src="/pers_pers.js.action"></script>
<script charset="utf-8" type="text/javascript" src="/pers_persEmpSelectWidget.js.action"></script>
<script charset="utf-8" type="text/javascript" src="/pers/js/ajaxfileupload.js"></script>
<link rel="stylesheet" type="text/css" href="/pers/css/persEmpSelectWidget.css" media="screen" />
<script charset="utf-8" type="text/javascript" src="/public/controls/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_drag.js"></script>
		<script type="text/javascript">
			dhtmlx.skin = "dhx_skyblue";
			//系统信息配置类
			var sysCfg = 
			{
				dhxSkin : "dhx_skyblue",
				rootPath : "",
				devMode : Boolean("false"),
				dhxShortDateFmt : "%Y-%m-%d",
				dhxLongDateFmt : "%Y-%m-%d %H:%i:%s",
				sysShortDateFmt : "yyyy-MM-dd",
				sysLongDateFmt : "yyyy-MM-dd H:mm:ss",
				ret : "ret",
				msg : "msg",
				data : "data",
				success : "ok",
				error : "400",
				warning : "500"
			};
			//消息控件的使用类型的类
			var msgType = 
			{
				info : "info",
				success : "success",
				warning : "warning",
				error : "error",
				loading : "loading"
			};
		</script>
		<style type="text/css">
			.title{
				background-color: #a4bed4;
				height: 20px;
				line-height: 20px;
				color: #FFF;
				border-bottom: 2px solid #8ba1b3;
				font-weight: bold;
				text-align:left;
			}
				html,body {
					MIN-WIDTH: 400px !important;
					MIN-height: 200px !important;
				}
		</style>
  	</head>
	<body style="overflow: visible;">
		
<input type="hidden" id="systemCode" value="acc" />
<div style="width: 100%; height: 99.99%;overflow: hidden;">
	<div id="monitorParentId" style="width: 100%; height: 100%;overflow: hidden;">
		<!-- 搜索部分--begin -->
		<div id="rtMonitorSearch" class="searchTopBox" style="border: none;">
		    <table cellspacing="0" cellpadding="0" class="searchTable">
	  			<tr valign="middle">
	  				<td valign="middle">
	  					区域
	  				</td>
					<td valign="middle">
						<div id="areaZone" objName="baseArea" selectWidth="120"></div>
					</td>
					<td>
						状态
					</td>
					<td>
						<select style="width: 80px;" id="devStatus" onchange="dataFilter()">
							<option value="">------</option>
							<option value="1">在线</option>
							<option value="2">禁用</option>
							<option value="0">离线</option>
							<option value="-1">未知</option>
						</select>
					</td>
					<td>
						设备名称
					</td>
					<td>
						<input id="devName" type="text" style="width: 120px;" onchange="dataFilter()" onkeyup="dataFilter()"/>
					</td>
					<td valign="middle">
						序列号
					</td>
					<td valign="middle">
						<input id="devSn" type="text" style="width: 120px;" onchange="dataFilter()" onkeyup="dataFilter()"/>
					</td>
					<td valign="middle">
						<a id="clearSearch" href="javascript:clearCondition('rtMonitorSearch');$('input[filterObj]').val('');areaTree.setSubChecked(0,false);dataFilter();">清空</a>
					</td>
	   			</tr>
		    </table>
	    </div>
	    <!-- 搜索部分--end -->
	    
	    <!-- 门底部--begin -->
	    <div id="doorFooter" style="display: none">
	    	<div style="float: left;margin-left: 5px;">
	    		当前数量:<span id="doorCount">0</span>
	    	</div>
	    	<div class="divBorder" style="margin-left: 5%;">
	    		<img height="12px" src="/public/images/greenPilot.png"/>在线:<em id="doorOnlineCount">0</em>&nbsp; 
				<img height="12px" src="/public/images/yellowPilot.png"/>禁用:<em id="doorDisbleCount">0</em>&nbsp;
	    		<img height="12px" src="/public/images/redPilot.png"/>离线:<em id="doorOfflineCount">0</em>&nbsp;
				<img height="12px" src="/public/images/unknownPilot.png"/>未知:<em id="doorUnknownCount">0</em>
		    </div>
		    <div class="divBorder" style="margin-left: 5%;">
	    		门名称&nbsp;<input type="text" filterObj="door" name="name" style="height: 16px;line-height: 16px;margin-top: -2px" onchange="dataFilter()" onkeyup="dataFilter()"/>
		    </div>
	    </div>
	    <!-- 门底部--end -->
	    
	    <!-- 辅助输入底部--begin -->
	    <div id="auxInFooter" class="displayN">
	    	<div style="float: left;margin-left: 5px;">
	    		当前数量:<span id="auxInCount">0</span>
	    	</div>
	    	<div class="divBorder" style="margin-left: 5%;">
	    		<img height="12px" src="/public/images/greenPilot.png"/>在线:<em id="auxInOnlineCount">0</em>&nbsp; 
				<img height="12px" src="/public/images/yellowPilot.png"/>禁用:<em id="auxInDisbleCount">0</em>&nbsp;
	    		<img height="12px" src="/public/images/redPilot.png"/>离线:<em id="auxInOfflineCount">0</em>&nbsp;
				<img height="12px" src="/public/images/unknownPilot.png"/>未知:<em id="auxInUnknownCount">0</em>
		    </div>
		    <div class="divBorder" style="margin-left: 5%;">
	    		辅助输入名称&nbsp;<input type="text" filterObj="auxIn" name="name" style="height: 16px;line-height: 16px;margin-top: -2px" onchange="dataFilter()" onkeyup="dataFilter()"/>
		    </div>
	    </div>
	    <!-- 辅助输入底部--end -->
	    
	    <!-- 辅助输出底部--begin -->
	    <div id="auxOutFooter" class="displayN">
	    	<div style="float: left;margin-left: 5px;">
	    		当前数量:<span id="auxOutCount">0</span>
	    	</div>
	    	<div class="divBorder" style="margin-left: 5%;">
	    		<img height="12px" src="/public/images/greenPilot.png"/>在线:<em id="auxOutOnlineCount">0</em>&nbsp; 
				<img height="12px" src="/public/images/yellowPilot.png"/>禁用:<em id="auxOutDisbleCount">0</em>&nbsp;
	    		<img height="12px" src="/public/images/redPilot.png"/>离线:<em id="auxOutOfflineCount">0</em>&nbsp;
				<img height="12px" src="/public/images/unknownPilot.png"/>未知:<em id="auxOutUnknownCount">0</em>
		    </div>
		    <div class="divBorder" style="margin-left: 5%;">
	    		辅助输出名称&nbsp;<input type="text" filterObj="auxOut" name="name" style="height: 16px;line-height: 16px;margin-top: -2px" onchange="dataFilter()" onkeyup="dataFilter()"/>
		    </div>
	    </div>
	    <!-- 辅助输出底部--end -->
	    
	    <!-- 实时事件底部--begin -->
	    <div id="eventTop_footer" class="displayN">
	    	<div style="float: left;">
	    		当前数量:<em id="currEventCount">0</em>/<em id="maxEventCount">100</em>
	    	</div>
		    <div class="divBorder" style="margin-left: 5%;">
		    	总接收条数:<em id="totalEventCount">0</em>
		    </div>
		    <div class="divBorder" style="margin-left: 5%;">
	    		<img height="12px" src="/public/images/greenPilot.png"/>正常:<em id="normalEventCount">0</em>&nbsp; 
				<img height="12px" src="/public/images/yellowPilot.png"/>异常:<em id="warningEventCount">0</em>&nbsp;
				<img height="12px" src="/public/images/redPilot.png"/>报警:<em id="alarmEventCount">0</em>
		    </div>
		    <div style="float: right;">
		    	显示照片
		    	<input id="msgCheckbox" type="checkbox" onclick="enableMsg(this)" checked="checked"/>
		    </div>
	    </div>
	    <div id="eventBottom_footer" class="displayN">
	    	<div style="float: left;">
	    		开始时间:<span id="eventStartTime"></span>
	    	</div>
		    <div class="divBorder" style="margin-left: 5%;">
		    	已监控:&nbsp;<span id="monitorTime"></span>
		    </div>
		    <div class="divBorder" style="margin-left: 5%;">
		    	<a href="javascript:clearEventRow()">清空行数据</a>
		    </div>
		    <div class="divBorder" style="margin-left: 2px;">
		    	<a href="javascript:refreshEventRT()">重置</a>
		    </div>
		    <!-- <div style="float: right;">
				<img id="monitorStateImg" src="/public/images/greenPilotLamp.gif" height="12px"/>
				暂停监控
				<input type="checkbox" onclick="disableEventMonitor(this)"/>
			</div> -->
	    </div>
	    <!-- 实时事件底部--end -->
	</div>
</div>
<!-- 门DataView模板--begin -->
<textarea id="doorTemplateContainer" class="displayN">
	<div align="center">
		<div onmouseover="showPopUpInfo(this);" onmouseout="hidePopUpInfo(this);">
			<img onmousedown="return false;" border="0" src="/acc/images/doorState/icon/door_{obj.image}.jpg">
			<div class="displayN" style="position: fixed;top: 263px;left: 325px;z-index: 9999999;" align="left">
				<div class="poPupInfo">
					<p class="poPupInfo_title_p">状态</p>
					<table class="poPupInfo_text_table">
							<tr>
								<td>设备:</td>
								<td>{obj.devAlias}</td>
							</tr>
							<tr>
								<td>序列号:</td>
								<td>{obj.devSn}</td>
							</tr>
							<tr>
								<td>编号:</td>
								<td>{obj.no}</td>
							</tr>
							<tr>
								<td>门磁:</td>
								<td>{obj.sensor}</td>
							</tr>
							<tr>
								<td>继电器:</td>
								<td>{obj.relay}</td>
							</tr>
							<tr>
								<td>报警:</td>
								<td>{obj.alarm}</td>
							</tr>
					</table>
					<div style="display: {obj.opDisplay}">
						<ul class="poPupInfo_op_ul">
								<li onclick="operateDoor('accRTMonitorAction!openDoor.action', '{obj.id}')" title="远程开门">远程开门</li>
								<li onclick="operateDoor('accRTMonitorAction!closeDoor.action', '{obj.id}')" title="远程关门">远程关门</li>
								<li onclick="operateDoor('accRTMonitorAction!cancelAlarm.action', '{obj.id}')" title="取消报警">取消报警</li>
								<li onclick="operateDoor('accRTMonitorAction!normalOpenDoor.action', '{obj.id}')" title="远程常开">远程常开</li>
							<li onclick="operateDoor('accRTMonitorAction!enableNormalOpenDoor.action', '{obj.id}')" title="启用当天常开时间段">启用当天常开时间段</li>
								<li onclick="operateDoor('accRTMonitorAction!disableNormalOpenDoor.action', '{obj.id}')" title="禁用当天常开时间段">禁用当天常开时间段</li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<p class="dhx_item_text" style="word-wrap:break-word; word-break:normal;" title="{obj.name}">{obj.name}</p>
	</div>
</textarea>
<!-- 门DataView模板--end -->

<!-- 辅助输入DataView模板--begin -->
<textarea id="auxInTemplateContainer" class="displayN">
	<div align="center">
		<div onmouseover="showPopUpInfo(this);" onmouseout="hidePopUpInfo(this);">
			<img onmousedown="return false;" border="0" src="/acc/images/auxInState/icon/aux_in_{obj.image}.jpg" >
			<div class="displayN poPupInfo" style="position: fixed;top: 263px;left: 325px;z-index: 9999999;" align="left">
				<p class="poPupInfo_title_p">状态</p>
				<table class="poPupInfo_text_table">
						<tr>
							<td>设备:</td>
							<td>{obj.devAlias}</td>
						</tr>
						<tr>
							<td>编号:</td>
							<td>{obj.no}</td>
						</tr>
				</table>
			</div>
		</div>
		<p style="word-wrap:break-word; word-break:normal;" title="{obj.name}">{obj.name}</p>
	</div>
</textarea>
<!-- 辅助输入DataView模板--end -->

<!-- 辅助输出DataView模板--begin -->
<textarea id="auxOutTemplateContainer" class="displayN">
	<div align="center">
		<div onmouseover="showPopUpInfo(this);" onmouseout="hidePopUpInfo(this);">
			<img onmousedown="return false;" border="0" src="/acc/images/auxOutState/icon/aux_out_{obj.image}.jpg" >
			<div class="displayN poPupInfo" style="position: fixed;top: 263px;left: 325px;z-index: 9999999;" align="left">
				<p class="poPupInfo_title_p">状态</p>
				<table class="poPupInfo_text_table">
						<tr>
							<td>设备:</td>
							<td>{obj.devAlias}</td>
						</tr>
						<tr>
							<td>编号:</td>
							<td>{obj.no}</td>
						</tr>
				</table>
				<div style="display: {obj.opDisplay};">
					<ul class="poPupInfo_op_ul">
							<li onclick="operateAuxOut('accRTMonitorAction!openAuxOut.action', '{obj.id}')" title="关闭">打开</li>
							<li onclick="operateAuxOut('accRTMonitorAction!closeAuxOut.action', '{obj.id}')" title="远程关门">关闭</li>
					</ul>
				</div>
			</div>
		</div>
		<p class="dhx_item_text" style="word-wrap:break-word; word-break:normal;" title="{obj.name}">{obj.name}</p>
	</div>
</textarea>
<!-- 辅助输出DataView模板--end -->
		
		<!-- 
		<#include "/public/template/bottom.html">
		 -->
		
			<!-- 执行自定义的脚本 -->
<script type="text/javascript">

	//进行条件过滤
	function dataFilter()
	{
		for(var key in rtDataViews)
	    {
			rtDataViews[key].filter(function(obj,value){
				var areaIdArray = areaTree.comboxObj.getActualValue().split(",");
				if((areaIdArray == "" || $.inArray(obj.areaId.toString(), areaIdArray) != -1) 
						&& ($("#devName").val() == "" || obj.devAlias.indexOf($("#devName").val()) != -1)
						&& ($("#devStatus").val() == "" || obj.connect == $("#devStatus").val())
						&& ($("#devSn").val() == "" || obj.devSn.indexOf($("#devSn").val()) != -1)
						&& ($("input[filterObj="+ value +"]").val() == "" || obj[$("input[filterObj="+ value +"]").attr("name")].indexOf($("input[filterObj="+ value +"]").val()) != -1))
				{
					return true;
				}
				return false;
			},key);
			setViewFooterValues(key);
	    }
		
		eventFilter();
	}

	var areaTree = loadComboxTree("areaZone","baseAreaAction!getAreaTreeJson.action", dataFilter);
	
	var layoutName = "monitorParentId";
	var rtDataViews = new Array();
	
	var loadTotal = 3;
	var loadIndex = 0;
	var devStateClientId = "devState" +  new Date().getTime();//一个用户可以开多个页面，该值用来保存当前页面创建时间，及初始化状态的时间。
	var eventClientId = "eventData" + new Date().getTime();//一个用户可以开多个页面，该值用来保存当前页面创建时间，及初始化状态的时间。
	doRTMonitorLoad();
	function doRTMonitorLoad()
	{
		//构建当前页面的layout分块管理。
	    myLayouts[layoutName] = new dhtmlXLayoutObject("monitorParentId", "2E", sysCfg.dhxSkin);
		setLayoutResize(myLayouts[layoutName]);
		myLayouts[layoutName].cells("a").setHeight(220);
		myLayouts[layoutName].attachHeader("rtMonitorSearch");
		
		myLayouts[layoutName].cells("a").progressOn();
	    
	    var tabbar = myLayouts[layoutName].cells("a").attachTabbar();
		tabbar.setSkin(sysCfg.dhxSkin);
		tabbar.setImagePath("/public/controls/dhtmlx/dhtmlxTabbar/codebase/imgs/");
		//tabbar.enableAutoSize(false, true);
		
		var dataViewConfig = {
			type: {
		        template: "html->doorTemplateContainer",
		        css:"ficon",
		    	width:70,
				height:70,
				margin:0,
				padding:3
		    }
		};
		
		doInitDoor(tabbar, dataViewConfig);
		doInitAuxIn(tabbar, dataViewConfig);
		doInitAuxOut(tabbar, dataViewConfig);
	    
		tabbar.setTabActive("door");
		
	    initEventGrid();//加载事件列表
	    
		var intervalId = window.setInterval(function(){
			if(loadIndex == loadTotal)
			{
				myLayouts[layoutName].cells("a").progressOff();
				loadDevStateData();//开始加载数据
				window.clearInterval(intervalId);
			}
		},200);
	}
	
	/***门状态监控***/
	function doInitDoor(tabbar, dataViewConfig)
	{
		tabbar.addTab("door", "&nbsp;&nbsp;门&nbsp;&nbsp;", "*");
		tabbar.setCustomStyle("door", "#000", "green", "");
		//--doorOperate --- start
		var doorOperate = tabbar.cells("door").attachToolbar();
		doorOperate.id = "door";
		createToolbar("/baseAction!getPageXML.action?packageName=acc&actionName=accDoor&xmlFileName=AccRTMonitor",doorOperate);
		//--doorOperate --- end
		
		rtDataViews["door"] = tabbar.cells("door").attachDataView(dataViewConfig);
	    rtDataViews["door"].load("accRTMonitorAction!getAllDoor.action", "json", function(){
	    	loadIndex++;
	    	setViewFooterValues("door");
	    });
	    rtDataViews["door"].attachEvent("onItemDblClick", function(id){
	    	if(id.indexOf("CustomObject") == -1)
	    	{
	    		createWindow("accDoorAction!getById.action?id="+ id +"^0^0^910^420^编辑");
	    	}
		});
	    
	    var doorStatusBar = tabbar.cells("door").attachStatusBar();
	    doorStatusBar.setText($("#doorFooter").html());
	    $("#doorFooter").remove();
	}
	
	/***辅助输入状态监控***/
	function doInitAuxIn(tabbar, dataViewConfig)
	{
		tabbar.addTab("auxIn", "&nbsp;&nbsp;辅助输入&nbsp;&nbsp;", "*");
		tabbar.setCustomStyle("auxIn", "#000", "green", "");
	    //--auxInOperate --- start
		var auxInOperate = tabbar.cells("auxIn").attachToolbar();
		auxInOperate.id = "auxIn";
		createToolbar("/baseAction!getPageXML.action?packageName=acc&actionName=auxIn&xmlFileName=AccRTMonitor", auxInOperate);
		
		//--auxInDataView --- start
	    rtDataViews["auxIn"] = tabbar.cells("auxIn").attachDataView($.extend(dataViewConfig, {type: {template: "html->auxInTemplateContainer"}}));
	    rtDataViews["auxIn"].load("accRTMonitorAction!getAllAuxIn.action", "json", function(){
	    	loadIndex++;
	    	setViewFooterValues("auxIn");
	    	//myLayouts[layoutName].cells("a").progressOff();
	    });
	    var auxInStatusBar = tabbar.cells("auxIn").attachStatusBar("100%", "20px");
	    auxInStatusBar.setText($("#auxInFooter").html());
	    $("#auxInFooter").remove();
	}
	
	/***辅助输出状态监控***/
	function doInitAuxOut(tabbar, dataViewConfig)
	{
		tabbar.addTab("auxOut", "&nbsp;&nbsp;辅助输出&nbsp;&nbsp;", "*");
		tabbar.setCustomStyle("auxOut", "#000", "green", "");
	    //--auxOutOperate --- start
		var auxOutOperate = tabbar.cells("auxOut").attachToolbar();
		auxOutOperate.id = "auxOut";
		createToolbar("/baseAction!getPageXML.action?packageName=acc&actionName=auxOut&xmlFileName=AccRTMonitor", auxOutOperate);
	    
		//--auxOutDataView --- start
		rtDataViews["auxOut"] = tabbar.cells("auxOut").attachDataView($.extend(dataViewConfig, {type: {template: "html->auxOutTemplateContainer"}}));
	    rtDataViews["auxOut"].load("accRTMonitorAction!getAllAuxOut.action", "json", function(){
	    	loadIndex++;
	    	setViewFooterValues("auxOut");
	    });
	    var auxOutStatusBar = tabbar.cells("auxOut").attachStatusBar();
	    auxOutStatusBar.setText($("#auxOutFooter").html());
	    $("#auxOutFooter").remove();
	}
	
	function updateDoorName(id, name)
	{
		var viewData = rtDataViews["door"].get(id);
		viewData.name = name;
		rtDataViews["door"].set(id, viewData);
	}
	
	function operateDoor(itemId, id)
	{
		var objId = "door";
		if(rtDataViews[objId].first() == undefined)
		{
			messageBox({messageType:"alert",text: "当前没有符合条件的门！"});
			return;
		}
		else
		{
			remoteOperate(itemId, id, objId);
		}
	}
	
	function operateAuxOut(itemId, id)
	{
		var objId = "auxOut";
		if(rtDataViews[objId].first() == undefined)
		{
			messageBox({messageType:"alert",text: "当前没有符合条件的辅助输出！"});
		}
		else
		{
			remoteOperate(itemId, id, objId);
		}
	}
	
	function remoteOperate(itemId, id, objId)
	{
		var itemText = operateToolbars[objId].getListOptionText("moreActions",itemId);
		itemText = (itemText ? itemText : operateToolbars[objId].getItemText(itemId));
		
		var data = (id ? ({title: itemText, id: id, opObj: rtDataViews[objId].get(id).name}) : ({title: itemText, id: 0,opObj: "当前所有"}));
		
		//用户验证
    	verifyLoginPwd(function(data){
    		
    		function dealRetFun(result)//处理操作结果函数
    		{
    			if(result[sysCfg.ret] == sysCfg.success)
				{
					closeMessage();
					$.jBox.close();
					rtDataViews[objId].unselectAll();
					
					var text = "<div align='left' style='padding-left: 5px;border: 0px solid #a4bed4;'>" +
									"<div>" + result[sysCfg.msg] + "</div>" +
									"<div style='margin-top: 3px;max-height: 250px;overflow: auto;'>" + result[sysCfg.data] + "</div>" +
								"</div>";
					messageBox({messageType:"alert",text: text});
				}
				else
				{
					openMessage(msgType.error);
				}
    		}
    		
    		if(itemId.indexOf("open") != -1)
    		{
    			var html = "<div style='padding:10px;margin-left:30px;'>" +
    							"<div>目标:&nbsp;&nbsp;" + data.opObj + "</div>" +
	    						"<form id='openForm' action='" + itemId + "' method='post'>" +
	    							"打开:&nbsp;&nbsp;<input type='text' name='openInterval' size='8' value='15'/>" +
	    							"秒<span class='form_note'>(1-254)</span>" + 
	    						"</form>" +
							"</div>";
				$.jBox(html, {
					title: data.title,
					submit: function (v, h, f) {
					    if (v == "ok")
					    {
					    	$("#openForm").submit();
					        return false;
					    }
					}
				});
				setFocus($("input[name=openInterval]")[0]);
				$("input[name=openInterval]").focus();
				var alreadySubmit = false;
				$("#openForm").validate({
					rules : {
						"openInterval" : {
							required : true,
							range: [1, 254]
						}
					},
				 	submitHandler: function(form)
				   	{   
				 		$(".jbox-button-focus").addClass("jbox-button-hover");
						if(alreadySubmit) 
						{
							return;
						}
						alreadySubmit = true;
						onLoading(function(){
							if(data.id)
				    		{
				    			rtDataViews[objId].select(data.id);
				    		}
				    		else
				    		{
				    			rtDataViews[objId].selectAll();
				    		}
							$(form).ajaxSubmit({
								async : true,
								dataType : 'json',
								data: {
				        			ids: rtDataViews[objId].getSelected().toString()
								},
								success: function(result)
								{	
									dealRetFun(result);
								}
							});
						});
				   	} 
				 });
    		}
    		else
    		{
    			var html = "<div style='margin-top: -5px'>" +
    							"<div>目标:" + data.opObj + "</div>" +
	    						"<div>" + "你确定要执行{0}操作吗？".format(itemText) + "</div>" +
							"</div>";
				var alreadySubmit = false;
				$.jBox.confirm(html, data.title,
					function (v, h, f) {
					    if (v == "ok")
					    {
					    	$(".jbox-button-focus").addClass("jbox-button-hover");
					    	if(alreadySubmit) 
							{
								return;
							}	
							alreadySubmit = true;
					    	onLoading(function(){
					    		if(data.id)
					    		{
					    			rtDataViews["door"].select(data.id);
					    		}
					    		else
					    		{
					    			rtDataViews["door"].selectAll();
					    		}
					        	$.ajax({
									type: "POST",
									url: itemId,
									async : true,
									data: {
					        			ids: rtDataViews["door"].getSelected().toString()
									},
									success: function(result)
								    {
					        			dealRetFun(result);
									}
						        });
				       		});
					        return false;
					    }
					    return true;
					}
				);
				$(".jbox-button-focus").css("border", "1px solid #888888");
				$(".jbox-button-focus").focus();
    		}
    	}, data);
	}
	
	//显示浮动信息
	function showPopUpInfo(obj)
	{
		var offsetTop = $(obj).offset().top + $(obj).height()/1.5 - $(document).scrollTop();
		if($(document.body).height() - offsetTop < $(obj).children("div").height())//判断距离底部的距离是否小于提示框的高度
		{
			offsetTop = $(obj).offset().top - ($(document).scrollTop() + $(obj).children("div").height() + 10) + $(obj).height()/2.5;
		}
		var offsetLeft = $(obj).offset().left + $(obj).width()/1.5 - $(document).scrollLeft();
		if($(window).width() - offsetLeft < $(obj).children("div").width())//判断距离底部的距离是否小于提示框的高度
		{
			offsetLeft = $(obj).offset().left - ($(document).scrollLeft() + $(obj).children("div").width() + 10) + $(obj).width()/2.5;
		}
		
		$(obj).children("div").css("top", offsetTop);
		$(obj).children("div").css("left", offsetLeft);
		$(obj).children("div").show();
		
	}
	
	//隐藏浮动信息
	function hidePopUpInfo(obj)
	{
		$(obj).children("div").hide();
	}
	
	var jqAjax;
	var devStateTimeout;
	window.clearTimeout(devStateTimeout);
	function loadDevStateData()
	{
		window.clearTimeout(devStateTimeout);
		if(jqAjax)
    	{
    		jqAjax.abort();//中断请求
    	}
		jqAjax = $.ajax({
		    type: "GET",
		    url: sysCfg.rootPath + "/accRTMonitorAction!getDevStateData.action?clientId=" + devStateClientId,
		    dataType: "json",
		    async: true,
		    success: function(data)
		    {
				//console.log(rtData);
				if(data != null)
				{
					//console.log(rtData);
					dealDevStateData(data);//回调函数,获取门磁等状态
				}
				devStateTimeout = window.setTimeout("loadDevStateData()" , 1500);
		    },
		    error:function (XMLHttpRequest, textStatus, errorThrown)
		    {
	 			window.clearTimeout(devStateTimeout);
	 		}
		});
	}
	
	//处理设备状态数据
	function dealDevStateData(data)
	{
		for(var index in data)
		{
			var viewCode = index.substring(0,index.indexOf("States"));
			for(var i = 0; i < data[index].length; i++)
			{
				var id = data[index][i].id;
				if(rtDataViews[viewCode].exists(id))
				{
					var viewData = rtDataViews[viewCode].get(id);
					rtDataViews[viewCode].set(id, $.extend(viewData, data[index][i]));
				}
			}
			setViewFooterValues(viewCode);
		}
	}
    
	//设置grid底部的一些对象的值
	function setViewFooterValues(viewCode)
	{
		var offlineCount = 0;//离线
	    var onlineCount = 0;//在线
	    var disbleCount = 0;//禁用
	    var unknownCount = 0;//未知
	    
        for(var i = 0; i < rtDataViews[viewCode].dataCount(); i++)
        {
        	var connect = rtDataViews[viewCode].get(rtDataViews[viewCode].idByIndex(i)).connect;
        	switch (parseInt(connect))
	    	{
				case 0:
					offlineCount++;
					break;
				case 1:
					onlineCount++;
					break;
				case 2:
					disbleCount++;
					break;
				case -1:
					unknownCount++;
					break;
			}
        }
        
		$("#" + viewCode + "OfflineCount").html(offlineCount);
		$("#" + viewCode + "OnlineCount").html(onlineCount);
		$("#" + viewCode + "DisbleCount").html(disbleCount);
		$("#" + viewCode + "UnknownCount").html(unknownCount);
		
		$("#" + viewCode + "Count").html(rtDataViews[viewCode].dataCount());
		
	    return true;
	}
	
	//初始化事件列表
	var eventGrid;
	var eventTimeout;
	function initEventGrid()
	{
		/***实时事件***/
		//myLayouts[layoutName].cells("b").progressOn();
	    myLayouts[layoutName].cells("b").setText("实时事件");
	    myLayouts[layoutName].setCollapsedText("b", myLayouts[layoutName].cells("b").getText());
	    
	    eventGrid = myLayouts[layoutName].cells("b").attachGrid();
		eventGrid.setImagePath(sysCfg.rootPath + "/public/controls/dhtmlx/dhtmlxGrid/codebase/imgs/");
	    eventGrid.setSkin(sysCfg.dhxSkin);
	    
	    var menu = new dhtmlXMenuObject();
		menu.setIconsPath(sysCfg.rootPath + "/public/images/dhtmlxToolbarImgs/");
		menu.renderAsContextMenu();
		menu.attachEvent("onClick", function onButtonClick(menuItemId, type) 
		{
		    var data = eventGrid.contextID;
		    var datas = data.split("_");
		    var cardNo = eventGrid.cells(datas[0], eventGrid.getColIndexById("cardNo")).getValue();	//获取卡号，传到后台
		    if(menuItemId == "addCardToNewEmp")
		    {
		    	 createWindow("persCustomFieldAction!getAllField.action?cardNo=" + cardNo + "^0^0^900^480^新增");
		    }
		    else
		    {
		    	createWindow("accEmployeeAction!filterEmpByVaildCard.action?cardNo="+cardNo+"^0^0^900^480^选择人员")
		    }
		    return true;
		});
		
		var menuXMLString = '<menu>' + 
								'<item text="给该卡登记住户" img="comm_issueCard.png" id="addCardToNewEmp" />' + 
								'<item text="添加到已登记人员" img="comm_issueCard.png" id="addCardToOldEmp" />' +
							'</menu>';
		menu.loadXMLString(menuXMLString);
		eventGrid.enableContextMenu(menu);
		eventGrid.attachEvent("onBeforeContextMenu", function(rowId, celInd, grid){
			//判断事件点，过滤右键功能,当事件点的eventNo=27才能显示右键菜单
			if(this.getUserData(rowId, "isExistCardOp") && celInd == 5)
			{
				return true;
			} 
			return false;
			/*
			if (celInd == 5)
			{
				return true;
			}
			return false;*/
		});
		
		$.ajax({
			type: "POST",
			async: false,
			dataType: "json",
			url: "baseAction!getGridHeader.action",
			data: 
			{
				packageName: "acc",
				actionName: "accTransaction",
				xmlFileName: "accRTMonitor",
				dataFmt: "row"
			},
			success : function(data, textStatus) 
			{
				eventGrid.setHeader(data.headers);
				eventGrid.setColumnIds(data.ids);//不能出现空格
				eventGrid.setInitWidths(data.widths);//150
				eventGrid.setColAlign(data.aligns);
				eventGrid.setColTypes(data.types);//ro
				eventGrid.setColSorting(data.sorts);// 禁用排序
				
				eventGrid.setColumnMinWidth(data.minWidthBuffer);//设置列的最小宽度("50,70,70,70,70,70,70,70")
				eventGrid.enableHeaderMenu(data.headerMenuBuffer);//设置可进行字段可选的列
				
				eventGrid.enableAutoHeight(false);
				eventGrid.enableAutoWidth(false);
				
				var cspanStr = "#cspan";
				for(var i = 0; i < data.headers.split(",").length -2; i++)
				{
					cspanStr += ",#cspan";
				}
				eventGrid.attachFooter($("#eventTop_footer").html() + "," + cspanStr,"text-align:left;font-style:normal;");
			   	$("#eventTop_footer").remove();
			   	eventGrid.attachFooter($("#eventBottom_footer").html() + "," + cspanStr,"text-align:left;font-style:normal;");
			   	$("#eventBottom_footer").remove();
			   	eventGrid.init();
				
				//showLoading(true, gridName);//加载数据时进行提示
				initMonitorTime();
			}
		});
		loadEventData();
		myLayouts[layoutName].cells("a").progressOff();
	}
	
	//初始化监控时间
	var setTimeInterval;
	function initMonitorTime()
	{
		window.clearInterval(setTimeInterval);
		var eventStartTime = new Date();
		$("#eventStartTime").html(eventStartTime.format(sysCfg.sysLongDateFmt));
		function setMonitorTime()
 		{
 			var second = (new Date().getTime() - eventStartTime.getTime())/1000;
 			$("#monitorTime").html(formatSeconds(second));
 			
 		}
		setMonitorTime();
  		setTimeInterval = window.setInterval(setMonitorTime,1000);
	}
	
	//事件过滤
	function eventFilter()
	{
		eventGrid.filterBy(2,function(value, id){
			var areaName = areaTree.comboxObj.getComboText();
			if((areaName == "" || areaName.indexOf(this.cells(id,1).getValue()) != -1) 
						&& ($("#devName").val() == "" || value.indexOf($("#devName").val()) != -1)
						&& ($("#devSn").val() == "" || value.indexOf($("#devSn").val()) != -1))
			{
				return true;
			}
			else
			{
				return false;
			}
		}, true);
		setEventFooterValues();
		
	}
	
	//获取实时事件数据
	function loadEventData()
	{
		window.clearTimeout(eventTimeout);
		
		if(eventTimeout > 0)
		{
			$.ajax({
			    type: "GET",
			    url: sysCfg.rootPath+"/accRTMonitorAction!getEventData.action?clientId=" + eventClientId,
			    dataType: "json",
			    async: true,
			    success: function(data)
			    {
					if(data != null && typeof(eventGrid.setSizes) == "function")
					{
						var rows = data.rows;
						var normalNum = 0;
						var warningNum = 0;
						var alarmNum = 0;
						for(var index in rows) 
						{
							var id = rows[index].id;
							var maxEventCount = parseInt($("#maxEventCount").html());
							if(eventGrid.getRowsNum() >= maxEventCount)
							{
								eventGrid.deleteRow(eventGrid.getRowId(eventGrid.getRowsNum()-1));
							}
				        	eventGrid.addRow(id, rows[index].data, 0);
				        	eventGrid.setRowTextStyle(id, rows[index].style);
				        	for(var key in rows[index].userdata)
				        	{
				        		eventGrid.setUserData(id, key, rows[index].userdata[key]);
				        	}
				        	
				        	//消息提示
				        	eventMsg(id);
				        	
				        	switch (rows[index].userdata["status"])
					    	{
								case "normal":
									normalNum++;
									break;
								case "warning":
									warningNum++;
									break;
								case "alarm":
									alarmNum++;
									break;
							}
			        	}
						eventFilter();
						eventGrid.setSizes(false);
						setEventFooterValues(rows.length, normalNum, warningNum, alarmNum);
					}
					if(eventTimeout < 0)//是否暂停监控
					{
						return;
					}
					eventTimeout = window.setTimeout("loadEventData()" , 1500);
			    },
			    error:function (XMLHttpRequest, textStatus, errorThrown)
			    {
		 			window.clearTimeout(eventTimeout);
		 		}
			});
		}
		else
		{
			eventTimeout = window.setTimeout("loadEventData()" , 1500);
		}
		
	}
	
	//设置事件底部统计数据的值
	function setEventFooterValues(rowNum, normalNum, warningNum, alarmNum)
	{
		$("#currEventCount").html(eventGrid.getRowsNum());
		
		var totalCount = parseInt($("#totalEventCount").html());
		$("#totalEventCount").html(totalCount + (rowNum ? rowNum : 0));
		
		var normalCount = parseInt($("#normalEventCount").html());
		$("#normalEventCount").html(normalCount + (normalNum ? normalNum : 0));
		
		var warningCount = parseInt($("#warningEventCount").html());
		$("#warningEventCount").html(warningCount + (warningNum ? warningNum : 0));
		
		var alarmCount = parseInt($("#alarmEventCount").html());
		$("#alarmEventCount").html(alarmCount + (alarmNum ? alarmNum : 0));
	}
	
	//事件消息提示
	function eventMsg(id)
	{
		var photoPath = eventGrid.getUserData(id, "photoPath");
		console.log(photoPath);
		var empPinName = eventGrid.cells(id, eventGrid.getColIndexById("pinName")).getValue();
		var eventTime = eventGrid.cells(id, eventGrid.getColIndexById("eventTime")).getValue();
		var eventName = eventGrid.cells(id, eventGrid.getColIndexById("eventName")).getValue();
		var msgObj = document.getElementById("msgCheckbox");
		if(msgObj.checked &&photoPath!=null&&photoPath != "")//选中时开启
		{
			var text = "<div align='center' style='padding: 0px 15px 0px 15px;'>" +
							"<img src='" + photoPath + "' onerror='this.src=\"/pers/images/userImage.gif\"' style='max-height: 140px;border: 1px solid #a4bed4;'/>" +
							"<p>" + empPinName + "</p>" +
							"<p style='margin-top: 3px;'>" + eventName + "</p>" +
							"<p>" + eventTime + "</p>" +
						"</div>";
			$.jBox.messager(text, "消息提示", 0, {
			    width: 'auto',
			    showType: 'fade',
			    buttons: {'不再提示': "ok"},
			    submit: function (v, h, f) {
			    	msgObj.checked = false;
			    	enableMsg(msgObj);
			        return true;
			    }
			});
		}
	}
	
	//从cookie中获取消息提示
	if(typeof(getCookie("accRTEventMsg1")) != "undefined" && getCookie("accRTEventMsg1") != "")
	{
		document.getElementById("msgCheckbox").checked = eval(getCookie("accRTEventMsg1"));
	}
	
	//消息提示
	function enableMsg(obj)
	{
		if(obj.checked)//选中时则暂停
		{
			openMessage(msgType.success, "已开启消息提示");//运行消息提示
		}
		else
		{
			openMessage(msgType.warning, "已关闭消息提示");//关闭消息提示
		}
		
		createCookie("accRTEventMsg1", obj.checked);
	}
	
	//清空行
	function clearEventRow()
	{
		eventGrid.clearAll();
		setEventFooterValues();
	}
	
	//重置
	function refreshEventRT()
	{
		eventGrid.clearAll();
		$("#currEventCount").html(0);
		
		$("#totalEventCount").html(0);
		
		$("#normalEventCount").html(0);
		
		$("#warningEventCount").html(0);
		
		$("#alarmEventCount").html(0);
		
		initMonitorTime();
	}
	
	//暂停监控
	function disableEventMonitor(obj)
	{
		if(obj.checked)//选中时则暂停
		{
			window.clearTimeout(eventTimeout);
			eventTimeout = -1;
			//监控已暂停:监控已暂停
			openMessage(msgType.warning, "监控已暂停");
			$("#monitorStateImg").attr("src", sysCfg.rootPath +"/public/images/redPilotLamp.gif");
		}
		else
		{
			eventTimeout = 0;
			//监控已开启:监控已开启
			openMessage(msgType.success, "监控已开启");
			$("#monitorStateImg").attr("src", sysCfg.rootPath +"/public/images/greenPilotLamp.gif");
			loadEventData();
		}
	}
	
	resizeWindow();
</script>
	</body>

</html>
